package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUser;

/**
 * @author jack
 * @data 2024 14:28
 */

public class AppThreadLocalUtil {
    public static ThreadLocal<ApUser> threadLocal = new ThreadLocal<>();

    /**
     * 设置用户
     *
     * @param apUser AP用户
     */
    public static void setUser(ApUser apUser){
        threadLocal.set(apUser);
    }

    /**
     * 获取用户
     *
     * @return {@link ApUser}
     */
    public static ApUser getUser(){
        return threadLocal.get();
    }

    /**
     * 清理用户
     */
    public static void remove(){
        threadLocal.remove();
    }


}
